load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_license//rules:license.bzl", "license")

package(
    default_applicable_licenses = [":license"],
    default_visibility = ["//visibility:public"],
)

exports_files(["LICENSE"])

license(
    name = "license",
    package_name = "dumb-init",
    license_kinds = [
        "@rules_license//licenses/spdx:MIT",
    ],
    license_text = "LICENSE",
    package_url = "https://github.com/Yelp/dumb-init",
)

genrule(
    name = "version",
    srcs = ["VERSION"],
    outs = ["VERSION.h"],
    cmd = "./$(location @xxd) -i -n VERSION $< > $@",
    tools = ["@xxd"],
    visibility = ["//visibility:private"],
)

cc_binary(
    name = "dumb-init",
    srcs = [
        "VERSION.h",
        "dumb-init.c",
    ],
)
